package com.novax.ex.activity.provider.api;

import com.novax.ex.activity.provider.api.model.DrawEntity;
import com.novax.ex.activity.provider.api.model.DrawUpUserDetailRequest;
import com.novax.ex.activity.provider.api.model.DrawUserDetailEntity;
import com.novax.ex.activity.provider.api.model.DrawUserDetailRequest;
import com.novax.ex.activity.provider.api.model.DrawUserTotalEntity;
import com.novax.ex.activity.provider.common.ServerName;
import com.novax.ex.common.results.ReturnResult;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;

import java.util.List;

@FeignClient(url = "${remote.resource-service.endpoint}", name = "ResourceApi", contextId = "ResourceApi")
public interface ResourceApi {

    @PostMapping(value = "/blind-box/task-center")
    ReturnResult<Boolean> drawByTaskCenter(@RequestHeader("userId") Long userId,
                                           @RequestBody DrawUserDetailRequest request);

    @Operation(summary = "盲盒-查询开启活动")
    @GetMapping(value = "/blind-box/find-opened")
    ReturnResult<DrawEntity> findOpened();

    @Operation(summary = "根据传入userId获取用户抽奖次数 外部调用")
    @PostMapping(value = "/blind-box/select/user-id-list/{drawId}")
    ReturnResult<List<DrawUserDetailEntity>> selectByUserIdList(@PathVariable("drawId")Long drawId, @RequestBody List<Long> list);

    @Operation(summary = "获取用户成交量总计 外部调用")
    @PostMapping(value = "/blind-box/select-total/user-id-list/{drawId}")
    ReturnResult<List<DrawUserTotalEntity>> selectTotalByUserId(@PathVariable("drawId")Long drawId, @RequestBody List<Long> list);

    @Operation(summary = "抽奖信息更新 外部调用", hidden = true)
    @PostMapping(value = "/blind-box/update")
    void upUserDetail(@RequestBody DrawUpUserDetailRequest drawUpUserDetailRequest);

}
